﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Dycox.Reporting
{
    public abstract class FileSystemExporter : DataSheetExporter
    {
        public FileSystemExporter(string name)
            : base(name)
        {

        }

        public override void Save(DataSheet sheet, object argument)
        {
            string filename = argument as string, ext;

            if (filename == null)
                throw new ArgumentNullException(filename);

            ext = Path.GetExtension(filename).Substring(1).ToLower();

            WriteFile(sheet, filename, ext);
        }

        protected abstract void WriteFile(DataSheet sheet, string filename, string ext);

        protected abstract FileFilter[] Filters { get; }
    }
}
